package com.yjq.programmer.controller.app;

import com.yjq.programmer.dto.CommentDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.service.ICommentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-26 16:43
 */
@RestController("AppCommentController")
@RequestMapping("/app/comment")
public class CommentController {

    @Resource
    private ICommentService commentService;

    /**
     * 小程序发表评论操作
     * @param commentDTO
     * @return
     */
    @PostMapping("/submit")
    public ResponseDTO<Boolean> appSubmitComment(@RequestBody CommentDTO commentDTO) {
        return commentService.submitComment(commentDTO);
    }

    /**
     * 小程序根据音乐id获取评论数据
     * @param commentDTO
     * @return
     */
    @PostMapping("/getByMusicId")
    public ResponseDTO<List<CommentDTO>> appGetByMusicId(@RequestBody CommentDTO commentDTO) {
        return commentService.getCommentByMusicId(commentDTO);
    }

    /**
     * 小程序删除评论数据
     * @param commentDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> appRemoveById(@RequestBody CommentDTO commentDTO) {
        return commentService.removeComment(commentDTO);
    }
}
